Add WaitForConditionAsync polling primitive (DOTNET-8665)#2376
Draft
GarrettBeatty wants to merge 1 commit into
Draft
Add WaitForConditionAsync polling primitive (DOTNET-8665)#2376GarrettBeatty wants to merge 1 commit into
GarrettBeatty wants to merge 1 commit into
Conversation
|
|
||
| COPY bin/publish/ ${LAMBDA_TASK_ROOT} | ||
|
|
||
| ENTRYPOINT ["/var/task/bootstrap"] |
|
|
||
| COPY bin/publish/ ${LAMBDA_TASK_ROOT} | ||
|
|
||
| ENTRYPOINT ["/var/task/bootstrap"] |
|
|
||
| COPY bin/publish/ ${LAMBDA_TASK_ROOT} | ||
|
|
||
| ENTRYPOINT ["/var/task/bootstrap"] |
|
|
||
| COPY bin/publish/ ${LAMBDA_TASK_ROOT} | ||
|
|
||
| ENTRYPOINT ["/var/task/bootstrap"] |
|
|
||
| COPY bin/publish/ ${LAMBDA_TASK_ROOT} | ||
|
|
||
| ENTRYPOINT ["/var/task/bootstrap"] |
464c591 to
d308c3b
Compare
7f91202 to
3fa06ce
Compare
d308c3b to
be4c3ad
Compare
3fa06ce to
67f0c0c
Compare
ad4d208 to
3acbed5
Compare
Base automatically changed from
gcbeatty/durable-wave0
to
gcbeatty/durable-child-context
May 20, 2026 17:46
4d97473 to
8a6c41c
Compare
Base automatically changed from
gcbeatty/durable-child-context
to
feature/durablefunction
May 23, 2026 15:58
b007169 to
1a9a000
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new polling primitive (IDurableContext.WaitForConditionAsync) to Amazon.Lambda.DurableExecution, enabling service-mediated polling where each polling iteration runs in its own Lambda invocation (suspended/resumed via durable execution checkpoints). This expands the DurableExecution orchestration surface area with wait strategies, deterministic replay behavior, and supporting infrastructure plus unit/integration/AOT tests.
Changes:
- Introduces
WaitForConditionAsyncAPI surface, wait strategies (WaitStrategy.*), and supporting config/result types (WaitForConditionConfig<TState>,WaitDecision,IWaitStrategy<TState>,IConditionCheckContext,WaitForConditionException). - Adds core internal plumbing for durable execution (checkpoint batching, deterministic operation IDs, replay state tracking, wait operation, termination/suspension mechanism, SDK service client mapping).
- Adds substantial unit/integration coverage and an AOT publish smoke test project.
Reviewed changes
Copilot reviewed 114 out of 115 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/WaitStrategyTests.cs | Unit tests for wait strategy factories and WaitDecision behavior. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/UpperSnakeCaseEnumConverterTests.cs | Unit tests for enum wire-format JSON converter. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/TerminationManagerTests.cs | Unit tests for termination signaling/suspension coordination. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/RetryStrategyTests.cs | Unit tests for retry strategies and exponential backoff behavior. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/RecordingBatcher.cs | Test helper to capture flushed checkpoint batches. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/OperationIdGeneratorTests.cs | Unit tests for deterministic operation ID generation/hashing. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/ModelsTests.cs | Unit tests for model serialization and basic shape. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/MockLambdaClient.cs | Mock AmazonLambdaClient for service client tests. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/LambdaDurableServiceClientTests.cs | Unit tests for durable execution service client request/response mapping. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/ExecutionStateTests.cs | Unit tests for replay state tracking and operation lookup. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/ExceptionsTests.cs | Unit tests for exception types and properties. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/EnumsTests.cs | Unit tests for enum/constants shapes and values. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/DurableExecutionHandlerTests.cs | Unit tests for handler termination vs user-code completion race. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/coverage.sh | Local helper script for collecting and reporting coverage. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/coverage.runsettings | Coverage configuration for durable execution tests. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/ConfigTests.cs | Unit test for serialization context record equality. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/CheckpointBatcherTests.cs | Unit tests for batching, flushing, and error propagation semantics. |
| Libraries/test/Amazon.Lambda.DurableExecution.Tests/Amazon.Lambda.DurableExecution.Tests.csproj | New unit test project configuration and dependencies. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/xunit.runner.json | Integration test runner configuration (serial execution). |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/WaitOnlyTest.cs | Integration test validating wait-only suspend/resume behavior. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/WaitForConditionUserCheckThrowsTest.cs | Integration test for user check exception surfacing as StepException. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/WaitForConditionReplayDeterminismTest.cs | Integration test verifying replay determinism around polling. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/WaitForConditionMaxAttemptsTest.cs | Integration test for max-attempts exhaustion and error checkpointing. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/WaitForConditionHappyPathTest.cs | Integration test for successful polling completion. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/WaitForConditionExponentialTest.cs | Integration test for exponential wait strategy end-to-end. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitOnlyFunction/WaitOnlyFunction.csproj | Integration test function project for wait-only workflow. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitOnlyFunction/Function.cs | Wait-only durable workflow test function. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitOnlyFunction/Dockerfile | Container image for wait-only test function. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitForConditionUserCheckThrowsFunction/WaitForConditionUserCheckThrowsFunction.csproj | Integration test function project for user-check-throws scenario. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitForConditionUserCheckThrowsFunction/Function.cs | Durable workflow test function that throws from polling check. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitForConditionUserCheckThrowsFunction/Dockerfile | Container image for user-check-throws test function. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitForConditionReplayDeterminismFunction/WaitForConditionReplayDeterminismFunction.csproj | Integration test function project for replay determinism with polling. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitForConditionReplayDeterminismFunction/Function.cs | Workflow combining steps + polling to assert deterministic replay. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitForConditionReplayDeterminismFunction/Dockerfile | Container image for replay determinism test function. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitForConditionMaxAttemptsFunction/WaitForConditionMaxAttemptsFunction.csproj | Integration test function project for max-attempts exhaustion path. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitForConditionMaxAttemptsFunction/Function.cs | Workflow that catches WaitForConditionException and reports attempts. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitForConditionMaxAttemptsFunction/Dockerfile | Container image for max-attempts test function. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitForConditionHappyPathFunction/WaitForConditionHappyPathFunction.csproj | Integration test function project for successful polling path. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitForConditionHappyPathFunction/Function.cs | Workflow that polls until isDone and returns final state. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitForConditionHappyPathFunction/Dockerfile | Container image for happy-path polling function. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitForConditionExponentialFunction/WaitForConditionExponentialFunction.csproj | Integration test function project for exponential polling behavior. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitForConditionExponentialFunction/Function.cs | Workflow using exponential wait strategy with predictable timing. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/WaitForConditionExponentialFunction/Dockerfile | Container image for exponential polling function. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/StepWaitStepFunction/StepWaitStepFunction.csproj | Integration test function project for step-wait-step scenario. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/StepWaitStepFunction/Function.cs | Workflow with step → wait → step to validate suspend/resume replay. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/StepWaitStepFunction/Dockerfile | Container image for step-wait-step function. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/StepFailsFunction/StepFailsFunction.csproj | Integration test function project for step failure scenario. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/StepFailsFunction/Function.cs | Workflow that throws inside a step to validate failure propagation. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/StepFailsFunction/Dockerfile | Container image for failing-step function. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/RetryFunction/RetryFunction.csproj | Integration test function project for retry behavior. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/RetryFunction/Function.cs | Workflow using retry strategy to validate service-driven retries. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/RetryFunction/Dockerfile | Container image for retry function. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/ReplayDeterminismFunction/ReplayDeterminismFunction.csproj | Integration test function project for replay determinism via wait boundary. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/ReplayDeterminismFunction/Function.cs | Workflow that ensures cached step output persists across replay. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/ReplayDeterminismFunction/Dockerfile | Container image for replay determinism function. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/MultipleStepsFunction/MultipleStepsFunction.csproj | Integration test function project for multi-step chaining. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/MultipleStepsFunction/Function.cs | Workflow with five steps to validate checkpointing order. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/MultipleStepsFunction/Dockerfile | Container image for multi-step function. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/LongerWaitFunction/LongerWaitFunction.csproj | Integration test function project for longer waits. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/LongerWaitFunction/Function.cs | Workflow with longer wait to validate timer behavior and replay. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/TestFunctions/LongerWaitFunction/Dockerfile | Container image for longer-wait function. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/StepWaitStepTest.cs | Integration assertions for step-wait-step workflow. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/StepFailsTest.cs | Integration assertions for workflow failure behavior. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/RetryTest.cs | Integration assertions for service-mediated retries and timing. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/ReplayDeterminismTest.cs | Integration assertions for deterministic replay caching via wait. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/MultipleStepsTest.cs | Integration assertions for multi-step checkpointing consistency. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/LongerWaitTest.cs | Integration assertions for longer wait and multi-invocation behavior. |
| Libraries/test/Amazon.Lambda.DurableExecution.IntegrationTests/Amazon.Lambda.DurableExecution.IntegrationTests.csproj | New integration test project and AWS SDK dependencies. |
| Libraries/test/Amazon.Lambda.DurableExecution.AotPublishTest/Program.cs | NativeAOT publish smoke test exercising source-gen serializer path. |
| Libraries/test/Amazon.Lambda.DurableExecution.AotPublishTest/Amazon.Lambda.DurableExecution.AotPublishTest.csproj | NativeAOT/trim configuration for publish smoke test. |
| Libraries/src/Amazon.Lambda.DurableExecution/Services/LambdaDurableServiceClient.cs | Service client wrapper for checkpoint/state APIs (SDK interop). |
| Libraries/src/Amazon.Lambda.DurableExecution/Models/ErrorObject.cs | Serializable error representation for checkpoints/envelopes. |
| Libraries/src/Amazon.Lambda.DurableExecution/Models/DurableExecutionInvocationOutput.cs | Public output envelope model and JSON annotations. |
| Libraries/src/Amazon.Lambda.DurableExecution/Models/DurableExecutionInvocationInput.cs | Public input envelope model and internal replay state container. |
| Libraries/src/Amazon.Lambda.DurableExecution/Internal/WaitOperation.cs | Durable wait operation implementation (service-timer suspension). |
| Libraries/src/Amazon.Lambda.DurableExecution/Internal/UpperSnakeCaseEnumConverter.cs | JSON converter for UPPER_SNAKE_CASE enum wire format. |
| Libraries/src/Amazon.Lambda.DurableExecution/Internal/TerminationManager.cs | Termination/suspension signal coordination for orchestration. |
| Libraries/src/Amazon.Lambda.DurableExecution/Internal/ReflectionJsonCheckpointSerializer.cs | Reflection-based default checkpoint serializer with trim/AOT annotations. |
| Libraries/src/Amazon.Lambda.DurableExecution/Internal/OperationIdGenerator.cs | Deterministic operation ID generator compatible with other SDKs. |
| Libraries/src/Amazon.Lambda.DurableExecution/Internal/Operation.cs | Internal operation wire-model and constant strings. |
| Libraries/src/Amazon.Lambda.DurableExecution/Internal/ExponentialBackoff.cs | Shared exponential backoff delay calculation helper. |
| Libraries/src/Amazon.Lambda.DurableExecution/Internal/ExecutionState.cs | Replay-state hydration, lookup, and replay-frontier tracking. |
| Libraries/src/Amazon.Lambda.DurableExecution/Internal/DurableOperation.cs | Base class for durable operations with start/replay dispatch. |
| Libraries/src/Amazon.Lambda.DurableExecution/Internal/ChildContextOperation.cs | Durable child-context operation with checkpointed result/failure. |
| Libraries/src/Amazon.Lambda.DurableExecution/Internal/CheckpointBatcherConfig.cs | Configuration for outbound checkpoint batching. |
| Libraries/src/Amazon.Lambda.DurableExecution/Internal/CheckpointBatcher.cs | Background worker batching/flushing checkpoint updates. |
| Libraries/src/Amazon.Lambda.DurableExecution/IDurableContext.cs | Public durable context API surface (steps, waits, child contexts, polling). |
| Libraries/src/Amazon.Lambda.DurableExecution/IConditionCheckContext.cs | Context passed to wait-for-condition check function. |
| Libraries/src/Amazon.Lambda.DurableExecution/ICheckpointSerializer.cs | Public checkpoint serializer abstraction and serialization context record. |
| Libraries/src/Amazon.Lambda.DurableExecution/Exceptions/WaitForConditionException.cs | Exception type for polling exhaustion with last-state capture. |
| Libraries/src/Amazon.Lambda.DurableExecution/Exceptions/DurableExecutionException.cs | Base exception and related durable execution exception types. |
| Libraries/src/Amazon.Lambda.DurableExecution/Enums.cs | Public invocation status enum. |
| Libraries/src/Amazon.Lambda.DurableExecution/DurableExecutionHandler.cs | Core orchestration runner (user code vs termination race). |
| Libraries/src/Amazon.Lambda.DurableExecution/Config/WaitStrategy.cs | Wait strategy factories and built-in strategy implementations. |
| Libraries/src/Amazon.Lambda.DurableExecution/Config/WaitForConditionConfig.cs | Configuration container for polling operations. |
| Libraries/src/Amazon.Lambda.DurableExecution/Config/WaitDecision.cs | Strategy decision struct for continue/stop + delay. |
| Libraries/src/Amazon.Lambda.DurableExecution/Config/StepConfig.cs | Step execution configuration (retry/semantics). |
| Libraries/src/Amazon.Lambda.DurableExecution/Config/RetryStrategy.cs | Retry strategy factories and implementations, jitter/backoff options. |
| Libraries/src/Amazon.Lambda.DurableExecution/Config/IWaitStrategy.cs | Interface for wait strategies used by polling. |
| Libraries/src/Amazon.Lambda.DurableExecution/Config/IRetryStrategy.cs | Interface for retry strategies used by steps. |
| Libraries/src/Amazon.Lambda.DurableExecution/Config/ChildContextConfig.cs | Configuration for child contexts (subtype, error mapping). |
| Libraries/src/Amazon.Lambda.DurableExecution/Amazon.Lambda.DurableExecution.csproj | New durable execution library project definition and dependencies. |
| CONTRIBUTING.md | Adds Amazon.Lambda.DurableExecution to documented projects list. |
| buildtools/build.proj | Adds durable execution unit tests to the build/test pipeline. |
| .autover/autover.json | Registers new package for automated versioning. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+86
to
+90
| Error = sdkOp.StepDetails.Error != null ? new ErrorObject | ||
| { | ||
| ErrorType = sdkOp.StepDetails.Error.ErrorType, | ||
| ErrorMessage = sdkOp.StepDetails.Error.ErrorMessage | ||
| } : null, |
Comment on lines
+109
to
+113
| Error = sdkOp.ContextDetails.Error != null ? new ErrorObject | ||
| { | ||
| ErrorType = sdkOp.ContextDetails.Error.ErrorType, | ||
| ErrorMessage = sdkOp.ContextDetails.Error.ErrorMessage | ||
| } : null |
Comment on lines
+1
to
+2
| using System.Text.Json; | ||
| using System.Text.Json.Serialization; |
Adds service-mediated polling to the .NET Durable Execution SDK. WaitForConditionAsync repeatedly evaluates a check function with configurable wait strategy between attempts; each iteration is its own Lambda invocation (suspended via STEP+RETRY checkpoints carrying NextAttemptDelaySeconds), so polling does not consume compute time. Public surface: - IDurableContext.WaitForConditionAsync<TState> (reflection + AOT-safe overloads taking ICheckpointSerializer<TState>) - IConditionCheckContext (Logger + AttemptNumber) - WaitForConditionConfig<TState> (required InitialState + WaitStrategy) - IWaitStrategy<TState> with Decide(state, attempt) returning WaitDecision - WaitDecision (readonly record struct, ShouldContinue + Delay, Stop() / ContinueAfter(TimeSpan) factories) - WaitStrategy factories: Exponential / Linear / Fixed / FromDelegate, each accepting an optional Func<TState, bool> isDone predicate - WaitForConditionException with AttemptsExhausted and LastState (preserved across both live execution and replay) Internal: - WaitForConditionOperation<TState> wire format = STEP + SubType "WaitForCondition". Each polling iteration emits Action=RETRY with the new state in payload and NextAttemptDelaySeconds for the service to schedule the next invocation. - Strategies signal max-attempts exhausted by throwing WaitForConditionException directly from Decide(); the operation enriches with LastState before checkpointing FAIL. - LastState survives FAIL replay: serialized into FAIL payload at write time, deserialized in BuildFailureException with warning-logged fallback for legacy/corrupt data. - ExponentialBackoff helper extracted for sharing with ExponentialRetryStrategy. Math is byte-for-byte identical. - Reuses OperationSubTypes.WaitForCondition from Wave 0. Defaults: 60 attempts / 5s initial / 300s max / 1.5x rate / Full jitter - distinct from RetryStrategy.Default and matching Python/JS/Java reference SDKs. (Note: Python returns success on max-attempts; .NET/Java/JS throw - documented in design doc.) Adds 41 unit tests + 5 integration tests covering each wait strategy, isDone predicate paths, max-attempts exhaustion, user-check exceptions, replay determinism, exponential backoff bounds, and corrupt-payload fallback logging. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> updates
1a9a000 to
1759224
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#2216
What
Adds service-mediated polling to
Amazon.Lambda.DurableExecution.WaitForConditionAsyncrepeatedly evaluates a check function with a configurable wait strategy between attempts; each iteration runs in its own Lambda invocation (suspended viaSTEP+RETRYcheckpoints carryingNextAttemptDelaySeconds), so polling does not consume compute time while waiting between checks.Public API:
IDurableContext.WaitForConditionAsync<TState>(...)maxAttemptsis exhausted. Per-iteration state is serialized via theILambdaSerializerregistered onILambdaContext.Serializer(same pattern asStepAsync/RunInChildContextAsync).IConditionCheckContextLogger,AttemptNumber.WaitForConditionConfig<TState>InitialState+WaitStrategy.IWaitStrategy<TState>Decide(state, attempt)returningWaitDecision.WaitDecisionShouldContinue,Delay, factoriesStop()/ContinueAfter(TimeSpan).WaitStrategyfactoriesExponential,Linear,Fixed,FromDelegate— each accepting an optionalFunc<TState, bool> isDonepredicate.WaitForConditionExceptionmaxAttemptsis exhausted; carriesAttemptsExhaustedandLastState(preserved across both live execution and replay).How
Internal/WaitForConditionOperation<TState>runs as aSTEPwithSubType = "WaitForCondition":Decide(state, attempt)returns eitherStop()(success — return state) orContinueAfter(delay)(suspend until next attempt). Continuing emitsAction=RETRYwith the new state in the payload andNextAttemptDelaySecondsset so the durable execution service schedules the next invocation without consuming compute time.WaitForConditionExceptiondirectly fromDecide(); the operation enriches withLastStatebefore checkpointing FAIL.LastStatesurvives FAIL replay: serialized into the FAIL payload at write time and deserialized inBuildFailureExceptionwith a warning-logged fallback for legacy / corrupt data.ILambdaSerializervia stream-basedSerialize<T>/Deserialize<T>calls — no AOT trim attributes on the public API. MirrorsStepOperation/ChildContextOperation.ExponentialBackoffhelper is extracted for sharing between this operation andExponentialRetryStrategy. Math is byte-for-byte identical to the existing implementation.OperationSubTypes.WaitForConditionfrom Wave 0 (doc updates #2372).Defaults: 60 attempts, 5s initial delay, 300s max delay, 1.5x rate, Full jitter — distinct from
RetryStrategy.Defaultand matching Python/JS/Java reference SDKs.Stacked on top of #2372.
Fixes DOTNET-8665.
Testing
41 new unit tests covering each wait strategy, the
isDonepredicate paths, max-attempts exhaustion, user-check exceptions, replay determinism, exponential-backoff bounds, and corrupt-payload fallback logging:WaitStrategyfactory:Exponential,Linear,Fixed,FromDelegate— both with and withoutisDonepredicate.WaitForConditionExceptionthrown after max-attempts;AttemptsExhausted+LastStatepopulated.SUCCEEDEDreturns cached state,FAILEDreconstructsWaitForConditionExceptionwithLastState,STARTEDre-suspends.LastStatesurvives FAIL replay; corrupt FAIL payload falls back gracefully with a warning.ExponentialBackoffshared math: byte-for-byte identical toExponentialRetryStrategy(regression test).5 new integration tests build successfully (require AWS credentials to run).
Build clean: 0 warnings, 0 errors on net8.0 and net10.0.
Out of scope (follow-up PRs)
MapAsync/ continued parallel-suite work.DurableLoggerreplay-suppression (currentlyNullLogger).[DurableExecution]attribute.DurableTestRunner/Amazon.Lambda.DurableExecution.Testingpackage.dotnet new lambda.DurableFunctionblueprint.